#include<string>
#include<vector>
#include<iostream>
using namespace std;

string FormatMid(string mid)
{
	for (int i = 0; i<mid.length(); i++)
	{
		if (mid[i] == '-' && (i == 0 || mid[i - 1] == '('))
		{
			mid.insert(i, "0");
			i++;
		}
	}
	string realmid = "";
	for (int i = 0; i<mid.length(); i++)
	{
		if (mid[i] != '-')
		{
			realmid += mid[i];
		}
		else
		{
			int cou = 0;
			while (mid[i] == '-') i++, cou++;
			if (cou % 2 == 0) realmid += '+';
			else realmid += '-';
			i--;
		}
	}
	return realmid;
}